/*
 * Copyright (C) 2021 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * @addtogroup Bluetooth
 * @{
 *
 * @brief Defines a bluetooth system that provides basic blurtooth connection and profile functions,
 *        including A2DP, AVRCP, BLE, GATT, HFP, MAP, PBAP, and SPP, etc.
 *
 * @since 6
 */

/**
 * @file interface_profile_socket.h
 *
 * @brief Declares SPP interface profile functions, including basic functions.
 *
 * @since 6
 */

#ifndef INTERFACE_PROFILE_SOCKET_H
#define INTERFACE_PROFILE_SOCKET_H

#include "interface_profile.h"
#include "bt_uuid.h"

namespace bluetooth {
/**
 * @brief Class for IProfileSocket functions.
 *
 * @since 6
 */
class IProfileSocket : public IProfile {
public:
    /**
     * @brief The client initiates the connection.
     * @details The client queries the SDP and finds the channel to be connected through UUID.
     *          Client sets security level to GAP.
     * @param addr addr
     * @param uuid server record uuid to search scn.
     * @param securityFlag require the connection to be encrypted and authenticated.
     * @param type socket type.
     * @return the upper socket fd that generated by the socketpair .
     */
    virtual int Connect(const std::string &addr, const Uuid &uuid, int securityFlag, int type) = 0;

    /**
     * @brief The server listen and accept the connection.
     *
     * @details The server registers service records to SDP with service name, uuid and server channel
     *          number that assigned by rfcomm. Server sets security level to GAP.
     * @param name server service name.
     * @param uuid server uuid.
     * @param securityFlag require the connection to be encrypted and authenticated.
     * @param type socket type.
     * @return the upper socket fd that generated by the socketpair.
     */
    virtual int Listen(const std::string &name, const Uuid &uuid, int securityFlag, int type) = 0;

private:
    using IProfile::Connect;
};
}  // namespace bluetooth

#endif  // INTERFACE_PROFILE_SOCKET_H